using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace Dogfight2008
{
  public class Set<T> : IEnumerable<T>
  {
    Dictionary<T, bool> set = new Dictionary<T, bool>();

    public void Add(T t)
    {
      set[t] = true;
    }

    public int Count { get { return set.Keys.Count; } }

    public bool Contains(T t)
    {
      return set.ContainsKey(t);
    }

    public void Remove(T t)
    {
      if (set.ContainsKey(t))
        set.Remove(t);
    }

    public void AddRange(params T[] ts)
    {
      foreach (T t in ts)
        Add(t);
    }

    public IEnumerator<T> GetEnumerator()
    {
      return set.Keys.GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
      return GetEnumerator();
    }
  }
}
